﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Devtm.Common
{
    
    public static class Validations
    {



        [System.Diagnostics.DebuggerStepThrough]
        public static T CheckArgumentNull<T>(T self, string argumentName)
        {

            if (self.IsNull())
                throw self.ArgumentNull(argumentName);

            return self;

        }



        [System.Diagnostics.DebuggerStepThrough]
        public static bool PauseIs(this bool self)
        {

            if (self && System.Diagnostics.Debugger.IsAttached)
                System.Diagnostics.Debugger.Break();

            return self;

        }


        [System.Diagnostics.DebuggerStepThrough]
        public static bool PauseIs<T>(this T self, T value)
        {

            bool v = (self.Equals(default(T)) && value.Equals(default(T))) || self.Equals(value);

            if (v && System.Diagnostics.Debugger.IsAttached)
                System.Diagnostics.Debugger.Break();

            return v;

        }


        [System.Diagnostics.DebuggerStepThrough]
        public static bool IsNull(this object self)
        {

            bool v = self == null;

            if (v && System.Diagnostics.Debugger.IsAttached)
                System.Diagnostics.Debugger.Break();

            return v;

        }


        [System.Diagnostics.DebuggerNonUserCode]
        public static bool IsNullOrEmpty(this string self)
        {

            bool v = string.IsNullOrEmpty(self);

            if (v && System.Diagnostics.Debugger.IsAttached)
                System.Diagnostics.Debugger.Break();

            return v;

        }


        [System.Diagnostics.DebuggerStepThrough]
        public static bool ForIsNotNull(this object self)
        {

            bool v = self != null;

            if (v && System.Diagnostics.Debugger.IsAttached)
                System.Diagnostics.Debugger.Break();

            return v;

        }


        [System.Diagnostics.DebuggerStepThrough]
        public static bool ForIsDefault<T>(this T self)
        {

            bool v = self.Equals(default(T));

            if (v && System.Diagnostics.Debugger.IsAttached)
                System.Diagnostics.Debugger.Break();

            return v;

        }


        [System.Diagnostics.DebuggerStepThrough]
        public static bool ForIsNotDefault<T>(this T self)
        {

            bool v = !self.Equals(default(T));

            if (v && System.Diagnostics.Debugger.IsAttached)
                System.Diagnostics.Debugger.Break();

            return v;

        }


        [System.Diagnostics.DebuggerStepThrough]
        public static bool ForIsNot<T>(this T self, T value)
        {

            bool v = !((self.Equals(default(T)) && value.Equals(default(T))) || self.Equals(value));

            if (v && System.Diagnostics.Debugger.IsAttached)
                System.Diagnostics.Debugger.Break();

            return v;

        }



    }
}
